Turn: http://www.cnblogs.com/anniey/p/6184301.htmlToday, I encountered a non-contact method, which is Localecompare (). Check out some of the relevant documents, the definition is vague, so write down your own understanding.Let's start with an
This article mainly introduces how to use sort and localeCompare in JS to implement Chinese sorting. It focuses on the localeCompare function. If you need it, refer to Table sorting, the first thing we need to talk about is the sorting of arrays,
This article mainly introduces how to use sort and localeCompare in JS to implement Chinese sorting. It focuses on the localeCompare function. If you need it, refer to Table sorting, the first thing we need to talk about is the sorting of arrays,
When it comes to table sorting, the first thing we should talk about is array sorting, Because array sorting is the basis of table sorting. JavaScript provides the sort () method for Arrays for table sorting. By default, this method will sort the
Use of the localeCompare () method to operate strings in JavaScript
This article describes how to use the localeCompare () method to operate strings in JavaScript. It is the basic knowledge of getting started with JavaScript. For more information,
LocaleCompare () method
Definition and usageCompares two strings in a specific local order.SyntaxStringObject. localeCompare (target)Parameter descriptionTarget string to be compared with stringObject in a specific local order.Return ValueNumber of
When it comes to table sorting, the first thing to say is the sort of array, because array sorting is the basis for table sorting.
JavaScript provides a sort () method for table sorting by default, which causes arrays in an array to be arranged in
Localecompare () method
Definition and usage
Compares two strings in a specific local order.Syntax
stringObject.localeCompare(target)
Parameters
Description
Target
String to be compared with stringobject in a specific
Google many times only found on foreign websites have prompted how to compare Chinese, the original address: http://www.webdeveloper.com/forum/showthread.php? T = 9365
Prerequisites: unicode encoding is used. If other GBK encoding methods are used,
Definition: Compares two strings in a local-specific order.Grammar:stringObject.localeCompare(target)Parameters: target--The string to be compared with stringobject in a local-specific order.Return value: A number that describes the result of the
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.